import { pget, ppostJson } from '@/utils/req'
import { modalApi } from '@/utils/modalReq'
/**
 * 商品方案列表
 * @param params
 * @returns
 */
export async function commodityList(params: any): Promise<any> {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/listByParams`,
		params,
	)
}

/**
 * 【分页查询】商品方案列表多品牌、租期、类型
 * @param params
 * @returns
 */
export async function listByParamsWithBrachesRentsTypes(params: any): Promise<any> {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/listByParamsWithBrandRentsTypes`,
		params,
	)
}

/**
 * 商品类型列表
 * @param params
 * @returns
 */
export async function getOrderType(): Promise<any> {
	return pget(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme-adapter/getOrderType`,
	)
}

/**
 * 审核状态列表
 * @param params
 * @returns
 */
export async function getApprovalStatus(): Promise<any> {
	return pget(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme-adapter/getApprovalStatus`,
	)
}

/**
 * 商品方案状态列表
 * @param params
 * @returns
 */
export async function getSchemeStatus(): Promise<any> {
	return pget(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme-adapter/getSchemeStatus`,
	)
}

/**
 * App【司机、渠道】获得商品方案列表
 * @param params
 * @returns
 */
export async function commodityProgrammes(params: any): Promise<any> {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/listByParams`,
		params,
	)
}

/** 获取导入失败列表 */
export function getCommodityimporterror(query?: any) {
	return pget(`${modalApi.marketing}/shopec-marketing/commodityimporterror/page`, query);
}

/** 保存商品方案导入数据 */
export function requisitionImport() {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/importCommoditySchemeSave`,
	)
}


/** 新增商品方案数据 */
export function save(data?: any) {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/save`,
		data,
	)
}

/** 编辑商品方案数据 */
export function editUpdate(data?: any) {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/edit/update`,
		data,
	)
}

/**
 * 商品方案编辑详情
 * @param params
 * @returns
 */
export async function editInit(query?: any): Promise<any> {
	return pget(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/edit/init`,
		query,
	)
}

/**
 * 商品方案详情
 * @param params
 * @returns
 */
export async function detail(query?: any): Promise<any> {
	return pget(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/detail`,
		query,
	)
}

/**
 * 复制保存商品方案
 * @param params
 * @returns
 */
export async function copySave(data?: any): Promise<any> {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/copy/save`,
		data,
	)
}

/**
 * 复制初始化商品方案
 * @param params
 * @returns
 */
export async function copyInit(query?: any): Promise<any> {
	return pget(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/copy/init`,
		query,
	)
}

/**
 * 商品方案选择司机奖励列表
 * @param params
 * @returns
 */
export async function rulespage(query?: any): Promise<any> {
	return pget(`${modalApi.marketing}/marketingrewardrules/rulespage`, query)
}

/**
 * 批量（含单个）审核商品方案
 * @param params
 * @returns
 */
export async function batchApproval(data?: any): Promise<any> {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/batch-approval`,
		data,
	)
}

/**
 * 审批工作流详情
 * @param params
 * @returns
 */
export async function approvalDetail(query?: any): Promise<any> {
	return pget(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/approvalDetail`,
		query,
	)
}

/**
 * 分页租金司机奖励
 * @param params
 * @returns
 */
export async function rentDriverList(params: any): Promise<any> {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/rent-driver/pageByParams`,
		params,
	)
}

/**
 * 分页租金渠道奖励
 * @param params
 * @returns
 */
export async function rentChannelList(params: any): Promise<any> {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/rent-channel/pageByParams`,
		params,
	)
}

/**
 * 启用停用按钮
 * @param params
 * @returns
 */
export async function updateDisableStatus(params: any): Promise<any> {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/updateDisableStatus?id=${params?.id}&disableStautus=${params?.disableStautus}`,
		params,
	)
}

/**
 * 【分页查询】关联司机活动列表
 * @param params
 * @returns
 */
export async function driverList(query: any): Promise<any> {
	return pget(
		`${modalApi.marketing}/shopec-marketing/rent-driver/list`,
		query,
	)
}

/**
 * 【分页查询】关联渠道活动列表
 * @param params
 * @returns
 */
export async function channelList(query: any): Promise<any> {
	return pget(
		`${modalApi.marketing}/shopec-marketing/rent-channel/list`,
		query,
	)
}

/**
 * 删除
 * @param params
 * @returns
 */
export async function remove(params: any): Promise<any> {
	return ppostJson(
		`${modalApi.marketing}/shopec-marketing/commodity-scheme/remove?ids=${params.ids}`,
	)
}

/**
 *
 * @param query 获取操作记录日志
 * @returns
 */
export function getOperatingRecord(query: any) {
	return pget(`${modalApi.common}/operatelog/list`, query)
}


/**
 *
 * @param query 获取唯一编号

 * @returns
 */
export function getOnlyCode(query?:any) {
	return pget(`${modalApi.marketing}/marketingrewardrules/getNo`, query)
}


